//
//  YXMarketViewController.m
//  跑跑快销
//
//  Created by 杨潇 on 14-4-28.
//  Copyright (c) 2014年 ylife. All rights reserved.
//

#import "YXMarketViewController.h"
#import "YXMarketView.h"
#import "YXOrderViewController.h"
#import "YXInventoryViewController.h"
#import "YXSalesVolumeViewController.h"
#import "YXSignInViewController.h"
#import "YXKindDisplayViewController.h"
#import "YXWorkPlanViewController.h"

@interface YXMarketViewController ()

@end

@implementation YXMarketViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationController.navigationBar.translucent = NO;
    YXMarketVIew * marketVi = [[YXMarketVIew alloc] init];
    self.view = marketVi;
    
    for (int i = 0; i < marketVi.count; i ++) {
        UIButton * btn = (UIButton *)[marketVi viewWithTag:i + 1];
        [btn addTarget:self action:@selector(buttonsClick:) forControlEvents:UIControlEventTouchUpInside];
    }
}

- (void)buttonsClick:(UIButton *)btn
{
    switch (btn.tag) {
        case 1:
        {
            YXOrderViewController * orderVC = [[YXOrderViewController alloc] init];
            [self setHidesBottomBarWhenPushed:YES];
            [self.navigationController pushViewController:orderVC animated:YES];
            [self setHidesBottomBarWhenPushed:NO];
        }
            break;
        case 2:
        {
            YXInventoryViewController * inventoryVC = [[YXInventoryViewController alloc] init];
            inventoryVC.title = @"库存选择";
            [self setHidesBottomBarWhenPushed:YES];
            [self.navigationController pushViewController:inventoryVC animated:YES];
            [self setHidesBottomBarWhenPushed:NO];
        }
            break;
        case 3:
        {
            YXSalesVolumeViewController * salesVolumeVC = [[YXSalesVolumeViewController alloc] init];
            salesVolumeVC.title = @"单品销量";
            [self setHidesBottomBarWhenPushed:YES];
            [self.navigationController pushViewController:salesVolumeVC animated:YES];
            [self setHidesBottomBarWhenPushed:NO];
        }
            break;
        case 4:
        {
            YXSignInViewController * signInVC = [[YXSignInViewController alloc] init];
            signInVC.title = @"签到";
            [self setHidesBottomBarWhenPushed:YES];
            [self.navigationController pushViewController:signInVC animated:YES];
            [self setHidesBottomBarWhenPushed:NO];
        }
            break;
        case 5:
        {
            YXKindDisplayViewController * signInVC = [[YXKindDisplayViewController alloc] init];
            signInVC.title = @"网点列表";
            [self setHidesBottomBarWhenPushed:YES];
            [self.navigationController pushViewController:signInVC animated:YES];
            [self setHidesBottomBarWhenPushed:NO];
        }
            break;
        case 6:
        {
            YXWorkPlanViewController * workPlanVC = [[YXWorkPlanViewController alloc] init];
            workPlanVC.title = @"计划任务";
            [self setHidesBottomBarWhenPushed:YES];
            [self.navigationController pushViewController:workPlanVC animated:YES];
            [self setHidesBottomBarWhenPushed:NO];
        }
            break;
            
        default:
            break;
    }
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
